using System;
using System.Collections.Generic;
#if UNITY_IOS
using System.Runtime.InteropServices;
#endif
using UnityEngine;

namespace Gj
{
    public enum AppNameLanguage
    {
        English,
        China,
    }

    [System.Serializable]
    public class AppNameSingle
    {
        public AppNameLanguage language;
        public string name;
    }

    public class AppNameManager
    {
        public static AppNameSettings settings;
        public static Dictionary<AppNameLanguage, string> iosRelation = new Dictionary<AppNameLanguage, string>();
        public static Dictionary<AppNameLanguage, string> androidRelation = new Dictionary<AppNameLanguage, string>();

        static AppNameManager()
        {
            settings = LoadSettings();
            iosRelation.Add(AppNameLanguage.English, "en");
            iosRelation.Add(AppNameLanguage.China, "zh-Hans");
            
            androidRelation.Add(AppNameLanguage.English, "en");
            androidRelation.Add(AppNameLanguage.China, "zh");
        }

        static public  string GetIos(AppNameLanguage language)
        {
            return iosRelation[language];
        }

        static public string GetAndroid(AppNameLanguage language)
        {
            return androidRelation[language];
        }

        private static AppNameSettings LoadSettings()
        {
            AppNameSettings loadedSettings =
                (AppNameSettings) Resources.Load("AppNameSettings", typeof(AppNameSettings));
            if (loadedSettings == null)
            {
                loadedSettings = ScriptableObject.CreateInstance<AppNameSettings>();
                Debug.LogError("AppNameSettings is not exist (Resources)");
            }

            return loadedSettings;
        }
    }
}